import React,{Suspense} from "react";
import { useState } from "react";
import { useRoutes } from "react-router-dom";
import routes from "./route";
import { useAppSelector,useAppDispatch,appShallowEqual } from "./store";
import { changeMessage } from "./store/modules/counter";


function App() {
  // const {count,message}=useAppSelector(state=>({
  //     count:state.counter.count,
  //     message:state.counter.message
  // }),appShallowEqual)

  // const dispatch=useAppDispatch()
  // const handleClick=()=>{
  //   dispatch(changeMessage("what"))
  // }
  
  return (
    <>
    {/* <h2>{message}</h2>
    <button onClick={handleClick}>change</button> */}
      <Suspense fallback="loading...">
        <div className="main">{useRoutes(routes)}</div>
      </Suspense>
    </>
  );
}

export default App;
